﻿<Window x:Class="Tum.PDE.LanguageDSL.Visualization.View.Forms.CategorizedSelectionPopup"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Select element" Height="800" Width="800"
        WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow"
        
        xmlns:attached="clr-namespace:Tum.PDE.LanguageDSL.Visualization.Attached">
    <Window.Resources>
        <!-- Template for displaying domain classes with image and description. -->
        <DataTemplate x:Key="ListElementsTemplate">
            <Grid Margin="0,0,0,5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="50"/>
                    <!-- Column for Image-->
                    <ColumnDefinition Width="*"/>
                    <!-- Column for Content -->
                </Grid.ColumnDefinitions>

                <!-- Place holder for the image-->
                <Image Source="/Tum.PDE.LanguageDSL.Visualization;component/Resources/Images/Class_32.png" Width="32" Height="32" />
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25" />
                        <!-- Row for Name-->
                        <RowDefinition Height="*" />
                        <!-- Row for Description -->
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0" Text="{Binding Path=DomainElementFullName}" FontWeight="Bold" FontSize="16" />
                    <TextBlock Grid.Row="1" Text="{Binding Path=Description}" FontStyle="Italic" HorizontalAlignment="Left" TextAlignment="Left" TextWrapping="WrapWithOverflow" Width="420" />
                </Grid>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <TabControl ItemsSource="{Binding Path=SelectableAdvCategories, Mode=OneWay}" x:Name="TabControlSelection" TabStripPlacement="Left" SelectedIndex="0">
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <TabControl ItemsSource="{Binding Path=Categories, Mode=OneWay}" TabStripPlacement="Top" SelectedIndex="0">
                        <TabControl.ContentTemplate>
                            <DataTemplate>
                                <ListBox x:Name="DomainClassListBox" ItemTemplate="{StaticResource ListElementsTemplate}" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                SelectedItem="{Binding Path=DataContext.SelectedViewModel, Mode=TwoWay, ElementName=TabControlSelection}"
                                attached:ListBoxHelper.DoubleClickDialogResult="True"
                                ItemsSource="{Binding Path=SelectableViewModels, Mode=OneWay}"/>
                            </DataTemplate>
                        </TabControl.ContentTemplate>
                        <TabControl.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Path=CategoryName}" Margin="5"/>
                            </DataTemplate>
                        </TabControl.ItemTemplate>
                    </TabControl>
                </DataTemplate>
            </TabControl.ContentTemplate>
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Path=CategoryName}" Margin="5"/>
                </DataTemplate>
            </TabControl.ItemTemplate>
        </TabControl>
        
        
    </Grid>
</Window>
